home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 136_01.zip / PORTIO.C < prev    next >
Text File  |  1993-06-01  |  769b  |  53 lines

  1. /*    HEADER:  CUG136.04;
  2.     TITLE:        PORTIO;
  3.     DATE:        1/27/1984;
  4.     DESCRIPTION:    "I/O Port routines for C/80";
  5.     KEYWORDS:    I/O subroutines, Port I/O;
  6.     SYSTEM:        CP/M;
  7.     FILENAME:    PORTIO.C;
  8.     AUTHORS:    R. Rodman;
  9.     COMPILERS:    C/80;
  10. */
  11.  
  12. /* port i/o routines for c/80 v3.0
  13.     840127 rr orig file */
  14.  
  15. #ifneed portout,PORTOUT
  16.  
  17. /* portout - send value to io port */
  18.  
  19. portout( p, v ) {
  20. #asm
  21.     LXI H,4
  22.     DAD SP
  23.     MOV A,M        ;point to first argument
  24.     STA OPORT
  25.     DCX H
  26.     DCX H        ;get second argument
  27.     MOV A,M
  28.     OUT 0
  29. OPORT    EQU $-1
  30. #endasm
  31. }
  32. #endif
  33.  
  34. #ifneed portin,PORTIN
  35.  
  36. /* portin - read input port */
  37.  
  38. portin( p ) {
  39. #asm
  40.     LXI H,2
  41.     DAD SP
  42.     MOV A,M        ;get port number
  43.     STA IPORT
  44.     IN 0
  45. IPORT    EQU $-1
  46.     LXI H,0
  47.     MOV L,A        ;return value
  48. #endasm
  49. }
  50. #endif
  51.  
  52.  
  53.